<template>
    <div class="cms-link">
        <div class="cms-link-content">

            <div class="link-left">
                <div class="link-title">友情链接</div>
                <div class="link-content">
                    <div class="link-content-http" v-for="item in linkItem">
                        <img :src="item.linkIcon" class="link-icon"/>
                        <span @click="toLink(item.linkAddress)" class="link-name">{{item.linkName}}</span>
                    </div>

                </div>
            </div>

            <div class="link-right">
                <div class="office-logo">
                    <div class="contact">
                        <p class="tx">联系电话</p>
                        <p class="webTel">{{office.officeTel}}</p>
                    </div>
                    <div class="contact">
                        <p class="tx">联系地址</p>
                        <p class="address">{{office.officeAddress}}</p>
                    </div>
                </div>
            </div>

            <div class="link-footer">
                {{footerConfig.paramValue}}
            </div>

        </div>
    </div>
</template>

<script>
    import linkApi from '@/api/linkApi'
    export default {
        name: "CmsLink",
        data(){
            return{
                officeId:'0010a5ad4b4e1293bb005199c2c8cb31',
                office:{},
                footerConfig:{},
                linkItem:[],
            }
        },
        methods:{
            toLink(link){
                window.open(link)
            }
        },
        created:async function(){
            let res = await linkApi.linkDetail();
            if (res.code=='200'){
                this.linkItem=res.data
            }
            let res2 = await linkApi.getOffice(this.officeId);
            if (res2.code=='200'){
                this.office=res2.data
            }
            let res3 = await linkApi.getByKey("footerConfig");
            if (res3.code=='200'){
                this.footerConfig = res3.data
            }
        }
    }
</script>

<style scoped>
    .cms-link{
        width: 100%;
        float: left;
        height: auto;
        margin-top: 50px;
    }
    .cms-link-content{
        width: 80%;
        margin-left: 10%;
        float: left;
        margin-bottom: 20px;
    }
    .link-left{
        width: 70%;
        float: left;
    }
    .link-right{
        width: 30%;
        float: left;
    }
    .link-title{
        font-size: 20px;
        font-weight: bold;
    }
    .link-content-http{
        width: 30%;
        height: 25px;
        line-height: 25px;
        float: left;
        margin-top: 20px;
        cursor: pointer;
    }
    .link-content-http:hover{
        color: #ff7908;
    }
    .link-icon{
        float: left;
        width: 20px;
        height: 20px;
    }
    .link-name{
        display: block;
        float: left;
        margin-left: 7px;
        padding-bottom: 10px;
        line-height: 25px;
    }
    .contact{
        margin-top: 50px;
    }
    .contact > .webTel,.address{
        font-size: 25px;
    }
    .link-footer{
        height: 50px;
        line-height: 50px;
        width: 100%;
        float: left;
        margin-top: 50px;
        border-top: 1px grey solid;
    }
</style>